/*kZime*/
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#include <cstdlib>
#include <algorithm>
#define MAXN 1000000
#define ull unsigned long long
#define ll long long  
using namespace std;
ull read() {
	ull k = 0, f = 1; char c = getchar();
	for(; !isdigit(c); c = getchar())if(c == '-') f = -1;
	for(; isdigit(c); c = getchar()) k = k * 10 + c - '0';
	return k * f;
}
/*-----------------------------------------------------------------------------*/

struct f{
	ull p, w;
}fl[MAXN];
ull n, m;

class bn{
public:
	ull s[101], l;
	string str;
	bn() {
		memset(s, 0, sizeof(s));
		l = 1;
	}
	bn operator + (const ull &b) {
		s[0] += b;
		for(int i = 0; i < l || s[i]; i++) {
			s[i + 1] += s[i] / 10;
			s[i] %= 10;
			if(i > l) l = i;
		}
		l++;
		while(!s[l - 1]) l--;
		return *this;
	}
	
	void output() {
		for(int i = l - 1; i >= 0; i--) {
			cout << (int) s[i];
		}
	}
}; 

bool cmp(f a, f b) {
	return a.w < b.w;
}

int main() {
#ifndef MYLAB
	freopen("haoi13_t2.in", "r", stdin);
	freopen("haoi13_t2.out", "w", stdout);
#else
	freopen("in.txt", "r", stdin);
#endif

	n = read();
	m = read();
	
	for(ull i = 0; i < n; i++) {
		fl[i].w = read(); 
		fl[i].p = read();
	}

	sort(fl, fl + n, cmp);
	
	ull s = 0, i = 0;
	bn ans;
	while(s <= m && i < n) {
		ull temp = fl[i].p * fl[i].w; 
		if(temp + s < m) {
			s += temp;
			ans = ans + fl[i].p;
			i++;
		}
		else {
			ans = ans + (m - s) / fl[i].w;
			break;
		}
	}

	ans.output();

	return 0;
}

